<template>
  <div class="balance">
    <user-menu active="3" />
    <div class="u-container">
      <ul class="clearfix toptab">
        <li class="tabactive">
          <p>我的订单</p>
        </li>
      </ul>
      <div class="orderContent">
        <div class="order-wrap">
          <div
            class="order-list"
            v-for="index in 4"
            :key="index"
          >
            <p class="myOrder-number">
              <i class="el-icon-s-order"></i>订单编号：1710131423373920
              <span class="date">2017-10-13 14:23:37</span>
              <i
                class="el-icon-delete"
                title="删除订单"
                @click="deleteOrder"
              ></i>
            </p>
            <div class="myOrder-course">
              <div class="course">
                <img
                  class="course-pic"
                  src="@/assets/img/test/test.jpg"
                  width="160"
                  height="90"
                >
                  <div class="name">
                    <p>微信小程序入门与实战 常用组件 API 开发技巧 项目实战</p>
                  </div>
                  <div class="payPrice">
                    <p>￥149.00</p>
                  </div>
                  <div class="course-code">
                    <el-button
                      @click="showCode"
                      type="text"
                    >查看二维码</el-button>
                      <el-dialog
                        title="二维码"
                        width="300px"
                        :visible.sync="dialogCodeVisible"
                      >
                        <img
                          width="260"
                          height="260"
                          src="@/assets/img/test/test.jpg"
                        >
                          </el-dialog>
                  </div>
                  <div class="course-feedback">
                    <el-button
                      @click="feedbackConfirm"
                      type="text"
                    >失效反馈</el-button>
                  </div>
              </div>
            </div>
        </div>
      </div>
      <div class="tablePagination">
        <el-pagination
          background
          layout="prev, pager, next"
          :total="10"
        >
          </el-pagination>
      </div>
    </div>
  </div>

  </div>
</template>

<script>
import UserMenu from '@/components/UserMenu.vue'
export default {
  components: {
    UserMenu
  },
  data() {
    return {
      dialogCodeVisible: false
    }
  },
  mounted() {},
  methods: {
    showCode() {
      this.dialogCodeVisible = true
    },
    deleteOrder() {
      this.$msgbox
        .confirm('确认删除订单?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          center: true
        })
        .then(() => {
          this.$message({
            type: 'success',
            message: '删除成功!'
          })
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          })
        })
    },
    feedbackConfirm() {
      this.$msgbox
        .confirm('该课程的二维码已失效，请快速解决', '失效反馈确认', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          center: true
        })
        .then(() => {
          this.$message({
            type: 'success',
            message: '发送成功!'
          })
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消反馈'
          })
        })
    }
  }
}
</script>
<style lang="scss">
.orderContent {
  // padding: 30px;
  .order-list {
    box-shadow: 0 2px 8px 2px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    margin-top: 15px;
    padding: 20px;
    box-sizing: border-box;
    .myOrder-number {
      padding: 10px 0 15px;
      font-weight: 700;
      color: #4d555d;
      border-bottom: 1px solid #e5e5e5;
      font-size: 14px;
      line-height: 14px;
      box-sizing: border-box;
      i {
        font-size: 20px;
        font-weight: normal;
        vertical-align: middle;
      }
      .el-icon-s-order {
        color: rgba(240, 20, 20, 0.8);
        margin-right: 10px;
      }
      .date {
        font-weight: normal;
        margin-left: 10px;
        display: inline-block;
      }
      .el-icon-delete {
        float: right;
        color: #999;
        cursor: pointer;
        display: none;
      }
    }
    &:hover {
      .el-icon-delete {
        display: block;
      }
    }
    .course {
      padding-top: 20px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      .course-pic {
        width: 160px;
        margin-right: 20px;
      }
      .name {
        font-size: 14px;
        width: 300px;
      }
      .payPrice {
        width: 200px;
        text-align: center;
        font-size: 16px;
        color: #ff6666;
      }
      .course-code {
        width: 130px;
        .el-dialog__body {
          padding: 10px 20px 30px 20px;
        }
      }
    }
  }
}
</style>
